/*
 * @Author: your name
 * @Date: 2021-04-06 14:02:36
 * @LastEditTime: 2021-05-31 14:35:24
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \egg-demo\app\model\books.js
 */
'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE, UUIDV4, UUID } = app.Sequelize;

  const Books = app.model.define('books', {
     name: STRING(64),
      counts: INTEGER(5),
      last_couonts: INTEGER(5),
      intro: STRING(128),
      created_at: DATE,
      updated_at: DATE,
      uuid: { type: UUID, defaultValue: UUIDV4, primaryKey: true },
      user_uuid: {
        type: UUID,
        references: {
          model: 'users',
          key: 'uuid',
        },
        onUpdate: 'cascade',
        onDelete: 'cascade',
      },
  });

  return Books;
};
